<!DOCTYPE HTML>

<html ng-app lang="en">

{{>/head}}
<div class="col-md-4"></div>

			<!-- ========================================================================================================= -->
			<!-- Login Form --><div class="loginCtrl">
			<form ng-controller="loginController" name="LoginForm" id="login" class="col-md-4" novalidate>

				<h1 class="logoBigText"><span class="vcu">Ram</span> Badger</h1>
				<p class="motto">" Hone your skills with invigorating Tech Challenges. "</p>
                <br><br><br>
				<div class="form-group">
					<input type="text" placeholder="Username" name="Username" ng-model="user.username" class="form-control" required>
					<p
						class="help-block"
						ng-show="LoginForm.Username.$invalid && !LoginForm.Username.$error.required">
						Please enter a Valid Username.
					</p>
				</div>

				<div class="form-group">

					<input
				 		type="password"
						name="Password"
						placeholder="Password"
						ng-model="user.password"
						class="form-control"
						required
						ng-minlength="6"
					>



					<p
						class="help-block"
						ng-show="LoginForm.Password.$error.minlength || form.password.$invalid">
						Password must be at least 6 Characters.
					</p>
                </div>


			<div class="row">

			<div class="col-md-3">
			</div>

			<div class="col-md-6">
                <div class="form-group">
        			<button
            			type="submit"
            			ng-click="update(login)"
            			ng-disabled="loginForm.$invalid"
            			class="btn btn-success" >
            		Sign in
            		</button>           </div>
                 <div class="form-group">
                    <label>
                    					<input type="checkbox"> Remember Me
                    				</label></div>
			</div>




			<div class="col-md-3">
			</div>
            </div>
			</form><!--/Login Form--></div>
			<!-- ========================================================================================================= -->

			<div class="col-md-4 "></div>
{{>/foot}}
	<!--Temporary Inline script-->
	<script type="text/javascript">

	function loginController($scope, $http) {
	    $scope.master= {};
		$scope.user= {};
		$scope.output= {};
		$scope.submitURL="/login";
		$scope.update = function(user) {
			$scope.master= angular.copy(user);
            $http({
                method: "POST",
                url: $scope.submitURL,
                dataType: 'json',
                headers: {'Content-Type':'application/json'},
                data: ($scope.user)
            }).success(function(data){
                $scope.output.log= data;
                $scope.master={};
                window.location.reload(false);
            });
		}
		$scope.reset = function() {
			$scope.user = angular.copy($scope.master);
			$scope.form.$setPristine();
		};
	}</script>

</html>